package PAT;

import java.util.Scanner;

public class PAT1029 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s1 = scanner.nextLine();
        String s2 = scanner.nextLine();
        String[] s1s = s1.split(" ");
        String[] s2s = s2.split(" ");
        int len1 = s1s.length;
        int len2 = s2s.length;
        int len = len1 + len2;
        int midLen = len / 2;
        int index = 0, i = 0, j = 0;

        while (index++ < midLen) {
            if (j < len2 && i < len1) {
                if (Integer.parseInt(s1s[i]) >= Integer.parseInt(s2s[j])) {
                    j++;
                } else {
                    i++;
                }
            } else {
                if (j < len2) j++;
                else i++;
            }
        }
        if (len % 2 == 1) System.out.println(Math.max(Integer.parseInt(s1s[i]), Integer.parseInt(s2s[j])));
    }
}
